﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Portal.Exam.Model;
using Portal.Web.Model;
using Portal.Exam.Bussiness;
using Portal.Web.Utility;
using Portal.Core;

namespace Portal.Exam.Render
{
    public class ExamCollectionRenderBll
    {
        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut Draw(string SiteId)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                //ExamCollectionCls[] ExamCollections = ExamCollectionBll.ReadingExamCollection(SiteId, null);
                SiteParam OSiteParam = WebEnvironments.CreateSiteParam(SiteId);
                string IconRoot = WebConfig.GetButtonIconRoot(OSiteParam);
          
                string Html =
                   " <script language=javascript>\r\n" +
                   "    function ClientAdd()\r\n" +
                   "    {\r\n" +
                   "        window.open('AddExamCollection.aspx','_self');\r\n" +
                   "    }\r\n" +
                   "    function ClientUpdate(ExamCollectionId)\r\n" +
                   "    {\r\n" +
                   "        window.open('UpdateExamCollection.aspx?ExamCollectionId='+ExamCollectionId,'_self');\r\n" +
                   "    }\r\n" +
                   "    function ClientDelete(Id)\r\n" +
                   "    {\r\n" +
                   "        SiteId='"+SiteId+"';\r\n"+
                   "        if(confirm('Bạn đã chắc chắn xóa chưa?')==false)return;\r\n" +
                   "        AjaxOut = Portal.Exam.Render.ExamCollectionRenderBll.ServerSideDeleteExamCollection(SiteId,Id).value;\r\n" +
                   "        if(AjaxOut.Error)\r\n"+
                   "        {\r\n"+
                   "            alert(AjaxOut.InfoMessage);\r\n"+
                   "            return;\r\n"+
                   "        }\r\n"+
                   "        document.getElementById('divListItems').innerHTML=AjaxOut.HtmlContent;\r\n"+
                   "    }\r\n" +
                   " </script>\r\n" +
                   " <div class=FormFunction id=divListForm>\r\n" +
                   "    <div class=DatabaseFunction>\r\n" +
                   "        <ul>\r\n" +
                   "            <li onclick=\"javascript:ClientAdd();\"><img class=image src=\""+IconRoot+"/Add.png\"><div>Tạo mới</div></li>\r\n" +
                   "            <li onclick=\"javascript:window.open('../../folder.aspx?folder=exam','_self');\"><img class=image src=\"" + IconRoot + "/back.png\"><div>Quay lại</div></li>\r\n" +
                   "        </ul>\r\n" +
                   "    </div>\r\n" +
                   "    <div id=\"divListItems\">\r\n"+
                            ServerSideReading(SiteId).HtmlContent+
                   "    </div>\r\n"+
                   "</div>\r\n";
                OAjaxOut.HtmlContent = Html;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }

        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut ServerSideReading(string SiteId)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                ExamCollectionCls[] ExamCollections = ExamCollectionBll.ReadingExamCollection(SiteId, null);
                SiteParam OSiteParam = WebEnvironments.CreateSiteParam(SiteId);
                string IconRoot = WebConfig.GetButtonIconRoot(OSiteParam);
                string WebPartLayoutRoot = WebConfig.GetWebPartLayoutIconRoot(OSiteParam);
          
                string Html =
                   "  <h3>Danh sách các bộ sưu tập ngân hàng câu hỏi</h3>\r\n";
                if (ExamCollections.Length == 0)
                {
                    Html += "<div class=CssNoData>Chưa có bộ sưu tập nào</div>\r\n";
                }
                else
                {
                    Html += "<div class=tabcontent>\r\n" +
                            "   <table>\r\n"+
                            "   <tr>\r\n" +
                            "       <th></th>\r\n" +
                            "       <th>Tên chuyên mục</th>\r\n" +
                            "       <th>Mô tả</th>\r\n" +
                            "       <th></th>\r\n" +
                            "       <th></th>\r\n" +
                            "       <th></th>\r\n" +
                            " </tr>\r\n";
                    for (int iIndex = 0; iIndex < ExamCollections.Length; iIndex++)
                    {
                        Html +=
                            " <tr>\r\n" +
                            "   <td style=\"width:20px;\"><img title=\"" + ExamCollections[iIndex].Description + "\" alt=\"" + ExamCollections[iIndex].Description + "\" src=\"" + WebPartLayoutRoot + "/exam/ExamCollection.png\" class=image></td>\r\n" +
                            "   <td><a href=\"ExamCollectionTreeView.aspx?RId=" + ExamCollections[iIndex].ExamCollectionId + "\">" + ExamCollections[iIndex].ExamCollectionName + "</a></td>\r\n" +
                            "   <td>" + ExamCollections[iIndex].Description + "</td>\r\n" +
                            "   <td class=tdButton><input type=\"button\" class=\"button\" onclick=\"javascript:ClientDelete('" + ExamCollections[iIndex].ExamCollectionId + "');\" value=\"Xóa\"></td>\r\n" +
                            "   <td class=tdButton><input type=\"button\" class=\"button\" onclick=\"javascript:ClientUpdate('" + ExamCollections[iIndex].ExamCollectionId + "');\" value=\"Sửa\"></td>\r\n" +
                            "   <td class=tdButton><input type=\"button\" class=\"button\" onclick=\"javascript:window.open('ExamCollectionTreeView.aspx?RId="+ExamCollections[iIndex].ExamCollectionId+"','_self');\" value=\"Quản lý\"></td>\r\n" +
                            //open('GroupQuestionTreeView.aspx?RId=" + GroupQuestions[iIndex].GroupQuestionId + "','_self')
                            " </tr>\r\n";
                    }
                    Html +=
                        "</table>\r\n" +
                        "</div>\r\n";
                }

                OAjaxOut.HtmlContent = Html;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }


        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut ServerSideDeleteExamCollection(
            string SiteId,
            string ExamCollectionId)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                ExamCollectionBll.DeleteExamCollection(SiteId, ExamCollectionId);
                OAjaxOut.HtmlContent = ServerSideReading(SiteId).HtmlContent;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }



        public static string GetPlugInAddExamCollectionJavascript(string SiteId,bool UserAjax)
        {
            string RetHtml=
                    "<script language=javascript>\r\n" +
                    "   function SaveAddExamCollection()\r\n" +
                    "   {\r\n" +
                    "       SiteId='" + SiteId + "';\r\n" +
                    "       RootExamCollectionId=document.getElementById('txtRootExamCollectionId').value;\r\n" +
                    "       ParentExamCollectionId=document.getElementById('txtParentExamCollectionId').value;\r\n" +
                    "       ExamCollectionName = document.getElementById('txtExamCollectionName').value;\r\n" +
                    "       ExamCollectionDescription = document.getElementById('txtExamCollectionDescription').value;\r\n" +
                    "       SortIndex= document.getElementById('txtSortIndex').value;\r\n" +
                    "       OAjaxOut=Portal.Exam.Render.ExamCollectionRenderBll.ServerSideAddExamCollection(SiteId,ExamCollectionName,ExamCollectionDescription, RootExamCollectionId, ParentExamCollectionId, SortIndex).value;\r\n" +
                    "       if(OAjaxOut.Error)\r\n" +
                    "       {\r\n" +
                    "           alert(OAjaxOut.InfoMessage);\r\n" +
                    "           return;\r\n" +
                    "       }\r\n";
            if (UserAjax)
            {
                RetHtml +=
                    "       AddTreeNode(OAjaxOut.RefKeyId,ExamCollectionName);\r\n";
            }
            RetHtml+=
                    "       document.getElementById('txtExamCollectionName').value='';\r\n" +
                    "       document.getElementById('txtExamCollectionDescription').value='';\r\n" +
                    "       document.getElementById('txtSortIndex').value=parseInt(SortIndex)+1;\r\n" +
                    "       document.getElementById('txtExamCollectionName').focus();\r\n" +
                    "   }\r\n" +
                    "</script>\r\n";
            return RetHtml;
        }

        public static string GetPlugInUpdateExamCollectionJavascript(string SiteId, bool UserAjax)
        {
            string RetHtml =
                    "<script language=javascript>\r\n" +
                    "   function SaveUpdateExamCollection(ExamCollectionId)\r\n" +
                    "   {\r\n" +
                    "       SiteId='" + SiteId + "';\r\n" +
                    "       ExamCollectionName = document.getElementById('txtExamCollectionName').value;\r\n" +
                    "       ExamCollectionDescription = document.getElementById('txtExamCollectionDescription').value;\r\n" +
                    "       SortIndex= document.getElementById('txtSortIndex').value;\r\n" +
                    "       OAjaxOut=Portal.Exam.Render.ExamCollectionRenderBll.ServerSideUpdateExamCollection(SiteId,ExamCollectionId, ExamCollectionName,ExamCollectionDescription, SortIndex).value;\r\n" +
                    "       if(OAjaxOut.Error)\r\n" +
                    "       {\r\n" +
                    "           alert(OAjaxOut.InfoMessage);\r\n" +
                    "           return;\r\n" +
                    "       }\r\n";
            if (UserAjax)
            {
                RetHtml +=
                    "       SaveTreeNode(ExamCollectionId,ExamCollectionName);\r\n" +
                    "       BackFromUpdateExamCollection();\r\n";
            }
            else
            {
                RetHtml +=
                    "   window.open('ExamCollection.aspx','_self');\r\n";
            }
            RetHtml +=
                    "   }\r\n" +
                    "</script>\r\n";
            return RetHtml;
        }



        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut DrawAddExamCollection(string SiteId)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            string ParentExamCollectionId = (string)WebEnvironments.Request(SiteId, "ParentExamCollectionId");
            if (string.IsNullOrEmpty(ParentExamCollectionId)) ParentExamCollectionId = "";

            string RootExamCollectionId = (string)WebEnvironments.Request(SiteId, "RootExamCollectionId");
            if (string.IsNullOrEmpty(RootExamCollectionId)) RootExamCollectionId = "";

            string BackUrl = "ExamCollection.aspx";
            
            try
            {
                SiteParam OSiteParam = WebEnvironments.CreateSiteParam(SiteId);
                string IconRoot = WebConfig.GetButtonIconRoot(OSiteParam);
                string WebPartLayoutRoot = WebConfig.GetWebPartLayoutIconRoot(OSiteParam);
          
                string Html =
                    GetPlugInAddExamCollectionJavascript(SiteId,false)+

                    "<input type=hidden id=txtRootExamCollectionId value=\"" + RootExamCollectionId + "\">\r\n" +
                    "<input type=hidden id=txtParentExamCollectionId value=\"" + ParentExamCollectionId + "\">\r\n" +
                    "<div class=FormFunction id=divListForm>\r\n" +
                   " <div class=DatabaseFunction>\r\n" +
                   "        <ul>\r\n" +
                   "            <li onclick=\"javascript:SaveAddExamCollection();\"><img class=image src=\""+IconRoot+"/Save.png\"><div>Ghi lại</div></li>\r\n" +
                   "            <li onclick=\"javascript:window.open('" + BackUrl + "','_self');\"><img class=image src=\""+IconRoot+"/back.png\"><div>Quay lại</div></li>\r\n" +
                   "        </ul>\r\n" +
                   "  </div>\r\n" +
                   "</div>\r\n" +
                    "<div class=CssTip>Cho phép người quản lý tạo ra các bộ sưu tập ngân hàng câu hỏi. Các bộ sưu tập này sẽ chứa các câu hỏi trong hệ thống ngân hàng</div>\r\n" +
                    "<div class=CssFormSaveUpdate>\r\n" +
                    "   <table>\r\n" +
                    "       <tr>\r\n" +
                    "           <td  style=\"width:100px;\"><img style=\"width:100px;margin-right:10px;\" src=\""+WebPartLayoutRoot+"/Exam/ExamCollection.png\"></td>\r\n" +
                    "           <td>\r\n" +
                    "   <table>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Tên bộ sưu tập:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtExamCollectionName></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Mô tả:</td>\r\n" +
                    "       <td class=Col2><textarea id=txtExamCollectionDescription type=textarea class=textarea></textarea></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Thứ tự:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtSortIndex value=\"0\"></td>\r\n" +
                    "   </tr>\r\n" +
                    "</table>\r\n" +
                    "</td>\r\n" +
                    "</tr>\r\n" +
                    "</table>\r\n" +
                    "</div>\r\n";
                OAjaxOut.HtmlContent = Html;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }

        
        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut DrawAddExamCollectionForAjax(
            string SiteId, 
            string RootExamCollectionId,
            string ParentExamCollectionId, 
            string BackScript)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                SiteParam OSiteParam = WebEnvironments.CreateSiteParam(SiteId);
                string IconRoot = WebConfig.GetButtonIconRoot(OSiteParam);
                string WebPartLayoutRoot = WebConfig.GetWebPartLayoutIconRoot(OSiteParam);
          
                string Html =
                    "<input type=hidden id=txtRootExamCollectionId value=\"" + RootExamCollectionId + "\">\r\n" +
                    "<input type=hidden id=txtParentExamCollectionId value=\"" + ParentExamCollectionId + "\">\r\n" +
                    "<div class=FormFunction id=divListForm>\r\n" +
                   " <div class=DatabaseFunction>\r\n" +
                   "        <ul>\r\n" +
                   "            <li onclick=\"javascript:SaveAddExamCollection();\"><img class=image src=\""+IconRoot+"/Save.png\"><div>Ghi lại</div></li>\r\n" +
                   "            <li onclick=\"" + BackScript + "\"><img class=image src=\"" + IconRoot + "/back.png\"><div>Quay lại</div></li>\r\n" +
                   "        </ul>\r\n" +
                   "  </div>\r\n" +
                   "</div>\r\n" +
                    "<div class=CssTip>Cho phép người quản lý tạo ra các bộ sưu tập ngân hàng câu hỏi. Các bộ sưu tập này sẽ chứa các câu hỏi trong hệ thống ngân hàng</div>\r\n" +
                    "<div class=CssFormSaveUpdate>\r\n" +
                    "   <table>\r\n" +
                    "       <tr>\r\n" +
                    "           <td  style=\"width:100px;\"><img style=\"width:100px;margin-right:10px;\" src=\""+WebPartLayoutRoot+"/exam/ExamCollection.png\"></td>\r\n" +
                    "           <td>\r\n" +
                    "   <table>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Tên bộ sưu tập:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtExamCollectionName></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Mô tả:</td>\r\n" +
                    "       <td class=Col2><textarea id=txtExamCollectionDescription type=textarea class=textarea></textarea></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Thứ tự:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtSortIndex value=\"0\"></td>\r\n" +
                    "   </tr>\r\n" +
                    "</table>\r\n" +
                    "</td>\r\n" +
                    "</tr>\r\n" +
                    "</table>\r\n" +
                    "</div>\r\n";
                OAjaxOut.HtmlContent = Html;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }


        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut ServerSideAddExamCollection(
            string SiteId,
            string ExamCollectionName,
            string Description,
            string RootExamCollectionId,
            string ParentExamCollectionId,
            string SortIndex)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                if (string.IsNullOrEmpty(ExamCollectionName)) throw new Exception("Chưa nhập tên bộ sưu tập!");
                OAjaxOut.RefKeyId = ExamCollectionBll.AddExamCollection(SiteId, ExamCollectionName, Description, RootExamCollectionId, ParentExamCollectionId, SortIndex);
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }

        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut ServerSideUpdateExamCollection(
            string SiteId,
            string ExamCollectionId,
            string ExamCollectionName,
            string Description,
            string SortIndex)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                ExamCollectionBll.SaveExamCollection(SiteId, ExamCollectionId, ExamCollectionName, Description, SortIndex);
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }



        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut DrawUpdateExamCollectionForAjax(string SiteId, string ExamCollectionId, string BackScript)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                SiteParam OSiteParam = WebEnvironments.CreateSiteParam(SiteId);
                string IconRoot = WebConfig.GetButtonIconRoot(OSiteParam);
                string WebPartLayoutRoot = WebConfig.GetWebPartLayoutIconRoot(OSiteParam);
          
             
                ExamCollectionCls OExamCollection = ExamCollectionBll.CreateExamCollectionModel(SiteId, ExamCollectionId);
                string Html =
                    "<div class=FormFunction id=divListForm>\r\n" +
                   " <div class=DatabaseFunction>\r\n" +
                   "        <ul>\r\n" +
                   "            <li onclick=\"javascript:SaveUpdateExamCollection('"+ExamCollectionId+"');\"><img class=image src=\""+IconRoot+"/Save.png\"><div>Ghi lại</div></li>\r\n" +
                   "            <li onclick=\"" + BackScript + "\"><img class=image src=\""+IconRoot+"/back.png\"><div>Quay lại</div></li>\r\n" +
                   "        </ul>\r\n" +
                   "  </div>\r\n" +
                   "</div>\r\n" +
                    "<div class=CssTip>Cho phép người quản lý sửa bộ sưu tập ngân hàng câu hỏi. Các bộ sưu tập này sẽ chứa các câu hỏi trong hệ thống ngân hàng</div>\r\n" +
                    "<div class=CssFormSaveUpdate>\r\n" +
                    "   <table>\r\n" +
                    "       <tr>\r\n" +
                    "           <td  style=\"width:100px;\"><img style=\"width:100px;margin-right:10px;\" src=\""+WebPartLayoutRoot+"/Exam/ExamCollection.png\"></td>\r\n" +
                    "           <td>\r\n" +
                    "   <table>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Tên bộ sưu tập:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtExamCollectionName value=\"" + OExamCollection.ExamCollectionName + "\"></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Mô tả:</td>\r\n" +
                    "       <td class=Col2><textarea id=txtExamCollectionDescription type=textarea class=textarea>" + OExamCollection.Description + "</textarea></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Thứ tự:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtSortIndex value=\"" + OExamCollection.SortIndex + "\"></td>\r\n" +
                    "   </tr>\r\n" +
                    "</table>\r\n" +
                    "</td>\r\n" +
                    "</tr>\r\n" +
                    "</table>\r\n" +
                    "</div>\r\n";
                OAjaxOut.HtmlContent = Html;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }







        [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
        public static AjaxOut DrawUpdateExamCollection(string SiteId)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                SiteParam OSiteParam = WebEnvironments.CreateSiteParam(SiteId);
                string ExamCollectionId = (string)WebEnvironments.Request(SiteId, "ExamCollectionId");
                string IconRoot = WebConfig.GetButtonIconRoot(OSiteParam);
                string WebPartLayoutRoot = WebConfig.GetWebPartLayoutIconRoot(OSiteParam);


                ExamCollectionCls OExamCollection = ExamCollectionBll.CreateExamCollectionModel(SiteId, ExamCollectionId);
                string Html =
                    GetPlugInUpdateExamCollectionJavascript(SiteId,false)+
                    "<div class=FormFunction id=divListForm>\r\n" +
                   " <div class=DatabaseFunction>\r\n" +
                   "        <ul>\r\n" +
                   "            <li onclick=\"javascript:SaveUpdateExamCollection('" + ExamCollectionId + "');\"><img class=image src=\"" + IconRoot + "/Save.png\"><div>Ghi lại</div></li>\r\n" +
                   "            <li onclick=\"window.open('ExamCollection.aspx','_self');\"><img class=image src=\"" + IconRoot + "/back.png\"><div>Quay lại</div></li>\r\n" +
                   "        </ul>\r\n" +
                   "  </div>\r\n" +
                   "</div>\r\n" +
                    "<div class=CssTip>Cho phép người quản lý sửa bộ sưu tập ngân hàng câu hỏi. Các bộ sưu tập này sẽ chứa các câu hỏi trong hệ thống ngân hàng</div>\r\n" +
                    "<div class=CssFormSaveUpdate>\r\n" +
                    "   <table>\r\n" +
                    "       <tr>\r\n" +
                    "           <td  style=\"width:100px;\"><img style=\"width:100px;margin-right:10px;\" src=\"" + WebPartLayoutRoot + "/Exam/ExamCollection.png\"></td>\r\n" +
                    "           <td>\r\n" +
                    "   <table>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Tên bộ sưu tập:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtExamCollectionName value=\"" + OExamCollection.ExamCollectionName + "\"></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Mô tả:</td>\r\n" +
                    "       <td class=Col2><textarea id=txtExamCollectionDescription type=textarea class=textarea>" + OExamCollection.Description + "</textarea></td>\r\n" +
                    "   </tr>\r\n" +
                    "   <tr>\r\n" +
                    "       <td class=Col1>Thứ tự:</td>\r\n" +
                    "       <td class=Col2><input class=textbox type=textbox id=txtSortIndex value=\"" + OExamCollection.SortIndex + "\"></td>\r\n" +
                    "   </tr>\r\n" +
                    "</table>\r\n" +
                    "</td>\r\n" +
                    "</tr>\r\n" +
                    "</table>\r\n" +
                    "</div>\r\n";
                OAjaxOut.HtmlContent = Html;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error = true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }
    }
}
